package com.ah.shanxi_demo.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zt 2020/8/22
 */
public enum PolicyDeleteEnum implements PolicyCommonInterface{
    //同步类型
    UN_DELETE("0", "不删除"),
    DELETE("1", "删除"),
    ;

    private String key;
    private String value;

    final static Map<String, PolicyDeleteEnum> cacheDelete = new HashMap<>(values().length);

    static {
        for (PolicyDeleteEnum policyDeleteEnum : values()) {
            cacheDelete.put(policyDeleteEnum.key, policyDeleteEnum);
        }
    }

    PolicyDeleteEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static PolicyDeleteEnum convert(String key) {
        PolicyDeleteEnum type = cacheDelete.get(key);
        return type;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public Integer getKeyInt() {
        return Integer.parseInt(key);
    }

}
